#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 6, M = 17;
int A[N], c[N], n, m, t, k[M][N], a[N];
int main(){
    freopen("arena.in", "r", stdin);
    freopen("arena.out", "w", stdout);
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; ++ i) scanf("%d", &A[i]);
    for(int i = 1; i <= m; ++ i) scanf("%d", &c[i]);
    int K = 0, sum = 1;
    while(sum < n) sum *= 2, ++ K;
    for(int i = 1; i <= K; ++ i){
        sum /= 2;
        for(int j = 1; j <= sum; ++ j) scanf("%1d", &k[i][j]);
    }
    scanf("%d", &t);
    int x[4];
    while(t --){
        for(int i = 0; i < 4; ++ i) scanf("%d", &x[i]);
        for(int i = 1; i <= n; ++ i) a[i] = A[i] ^ x[i % 4];
    }
    return 0;
}
